package com.sinosoft.dsp.platform.components.system;

import java.io.Serializable;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.event.ActionEvent;

import org.primefaces.component.dialog.Dialog;
import org.primefaces.event.CloseEvent;

import com.sinosoft.dsp.platform.components.ViewHistoryBean;
import com.sinosoft.dsp.platform.utils.FacesContextUtils;
import com.sinosoft.dsp.system.core.log.Log;

/**
 * 平台Window的管理ViewBean类s
 * 
 * @author 潘巍（PeterPan）
 * @since 2011-5-24 下午08:36:28
 * 
 */
@ManagedBean(name = "windowSetViewBean")
@SessionScoped
public class WindowSetViewBean extends ViewHistoryBean implements Serializable,
		IWindowSetViewBean {

	private static final long serialVersionUID = 5424425463385991422L;

	private static final Log log = Log
			.getLog(WindowSetViewBean.class.getName());

	@Override
	public void handleClose(CloseEvent event) {
		Dialog dialog = (Dialog) event.getSource();
		this.removeView(dialog.getId());
	}

	@Override
	public void handleRemoteClose(ActionEvent actionEvent) {
		String winId = FacesContextUtils.getParameter("extParams");
		this.removeView(winId);
	}

	@PostConstruct
	@Override
	public void init() {
		try {
			super.init(null);
			this.setId("main-winSet");
		} catch (Exception e) {
			log.error("初始化窗口集视图。");
		}
	}

	@PreDestroy
	@Override
	public void destroy() {
		super.destroy();
	}
}
